﻿<%@ Page Title="" Language="VB" MasterPageFile="~/admin/admin.master" AutoEventWireup="false" CodeFile="admins.aspx.vb" Inherits="admin_admins" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <script src="../../js/jquery.js" type="text/javascript"></script>
    <script type="text/javascript">        

        function InitializeDeleteConfirmation() {
            $('#deleteConfirmationDialog').dialog({
                autoOpen: false,
                resizable: false,
                height: 140,
                modal: true,
                buttons: {
                    "Delete": function () {
                        $(this).dialog("close");
                    },
                    Cancel: function () {
                        $(this).dialog("close");
                    }
                }
            });
        }

        function deleteItem(uniqueID, itemID) {
            var dialogTitle = 'Permanently Delete Item ' + itemID + '?';
 
            $("#deleteConfirmationDialog").html('<p><span class="ui-icon ' + 
              'ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>' + 
              'Please click delete to confirm deletion.</p>');
 
            $("#deleteConfirmationDialog").dialog({
                title: dialogTitle,
                buttons: {
                    "Delete": function () { __doPostBack(uniqueID, ''); 
                              $(this).dialog("close"); },
                    "Cancel": function () { $(this).dialog("close"); }
                }
            });
 
            $('#deleteConfirmationDialog').dialog('open');
            return false;
        }

        $(function () {
            InitializeDeleteConfirmation();
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="mainContent" Runat="Server">
    <div class="page-header">
        <h1>University Administrators</h1>
    </div>
    <p>
        <asp:Repeater ID="FilteringUI" runat="server">
            <ItemTemplate>
                <asp:LinkButton runat="server" ID="lnkFilter"
                                Text='<%# Container.DataItem %>'
                                CommandName='<%# Container.DataItem %>'></asp:LinkButton>
            </ItemTemplate>

            <SeparatorTemplate>|</SeparatorTemplate>
        </asp:Repeater>
        <asp:HyperLink ID="HyperLink1" runat="server" CssClass="btn btn-primary pull-right" NavigateUrl="~/admin/admins/create-account.aspx"><i class="icon-user"></i> Create Login</asp:HyperLink>
    </p>
    <br />
    <div>
        <asp:GridView ID="UserAccounts" runat="server" AutoGenerateColumns="False" CssClass="table"
        GridLines="None" DataMember="UserName" DataKeyNames="UserName" 
            EnablePersistedSelection="True" PageSize="20">
        <Columns>
             
            <asp:BoundField DataField="UserName" HeaderText="UserName"  SortExpression="Email"/>
            <%--<asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email"/>--%>
            <asp:TemplateField HeaderText="Details" >
                <ItemTemplate>
                    <asp:Label ID="Label4" runat="server" Text='<%# Eval("Comment") %>'></asp:Label><br />
                    <asp:Label ID="Label3" runat="server" Text='<%# Eval("Email") %>'></asp:Label><br />
                    <small><strong>Creation Date</strong>
                        <asp:Label ID="Label2" runat="server" Text='<%# FormatDate(Eval("CreationDate")) %>'></asp:Label></small>
                    <small><strong>Last Login</strong>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("LastLoginDate") %>'></asp:Label></small>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:CheckBoxField DataField="IsApproved" HeaderText="Approved?" SortExpression="IsApproved"/>
            <%--<asp:CheckBoxField DataField="IsLockedOut" HeaderText="Locked Out?" />
            <asp:CheckBoxField DataField="IsOnline" HeaderText="Online?" /> --%>
            <%--<asp:BoundField DataField="Comment" HeaderText="Comment" SortExpression="Comment"/>--%>
            <asp:TemplateField>
                <ItemTemplate>                    
                    <asp:LinkButton ID="btnLink" runat="server" CommandArgument='<%# DataBinder.Eval(Container, "RowIndex") %>' CssClass="btn btn-success btn-small" 
                         CommandName="SelectUser" ToolTip="Lock Account"><i class="icon-lock"></i></asp:LinkButton>                    
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>                
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CommandArgument='<%# DataBinder.Eval(Container, "RowIndex") %>' CssClass="btn btn-danger btn-small" AlternateText='<%# Eval("UserName") %>'
                         CommandName="DeleteUser" ToolTip="Delete account" OnClientClick="javascript:return deleteItem(this.name, this.alt);"><i class="icon-remove"></i></asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    </div>
    <p>
        <asp:LinkButton ID="lnkFirst" runat="server">&lt;&lt; First</asp:LinkButton> |
        <asp:LinkButton ID="lnkPrev" runat="server">&lt; Prev</asp:LinkButton> |
        <asp:LinkButton ID="lnkNext" runat="server">Next &gt;</asp:LinkButton> |
        <asp:LinkButton ID="lnkLast" runat="server">Last &gt;&gt;</asp:LinkButton>
    </p>
</asp:Content>

